package com.community.contents.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.community.common.core.utils.Result;
import com.community.contents.dto.DiscussDTO;
import com.community.contents.entity.DiscussEntity;
import com.community.contents.service.IDiscussService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 话题
 *
 * @author hjs hjs@qq.com
 * @since 1.0.0 2023-02-21
 */
@RestController
@RequestMapping("contents/discuss")
@Api(tags="话题")
public class DiscussController {
    @Autowired
    private IDiscussService discussService;

    @PostMapping("page")
    public Result<Page<DiscussDTO>> page(@RequestBody Page<DiscussDTO> params){
        discussService.pageDto(params);
        return new Result<Page<DiscussDTO>>().ok(params);
    }


    @PostMapping
    public boolean save(@RequestBody DiscussEntity dto){
        return discussService.save(dto);
    }

}